﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ccit.Utils;

namespace Ccit.SysPlat.Organ
{
    /// <summary>
    /// Description: 系统平台组织机构 -> 机构管理业务层
    /// Author: tim 2010-01-28
    /// </summary>
    public class OrganBLL
    {
        #region initialize 

        IOrgan _organProcessor = null;

        public OrganBLL()
        {
            _organProcessor = Factory.CreateObject(MsOrgan.assemblyName, MsOrgan.className, ImportComponentType.DotNetDll, null) as IOrgan;
        }

        public void Release()
        {
            _organProcessor = null;
        }
        #endregion

        /// <summary>
        /// 获取机构信息
        /// </summary>
        /// <param name="organId">机构Id</param>
        /// <returns></returns>
        public MsOrgan GetOrganInfo(string organId)
        {
            if (string.IsNullOrEmpty(organId)) return null;
            MsOrgan msOrgan = _organProcessor.GetOrganInfo(organId);
            return msOrgan;            
        }

        /// <summary>
        /// 保存机构信息
        /// </summary>
        /// <param name="msOrgan">机构信息消息对象</param>
        /// <returns></returns>
        public List<string> Save(MsOrgan msOrgan)
        {
            if (null == msOrgan)
                return new List<string> { "-999", "保存失败:缺少必要参数!" };

            List<string> lstResult = _organProcessor.Save(msOrgan);
            return lstResult;
        }
    }
}
